﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using TireService.Data;

namespace TireService.Web
{
    public partial class BenifyURITest : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            TireServiceDB db = new TireServiceDB();

            // Get benify partner
            PartnerListEDI partner = db.GetPartnerEDI(1);

            // Copy interface file
            string month = DateTime.Now.Month.ToString();
            if (month.Length == 1)
            {
                month = "0" + month;
            }

            string day = DateTime.Now.Day.ToString();
            if (day.Length == 1)
            {
                day = "0" + day;
            }

            // Create xml filename
            string XMLfilename = "Mobilhjulskift_" + DateTime.Now.Year.ToString() + month + day;

            // Copy interface file
            System.UriBuilder UriBenify = new UriBuilder("ftp", partner.ServerLink, Convert.ToInt32(partner.Port), XMLfilename);

            Response.Write(UriBenify.Uri.AbsoluteUri);
        }
    }
}